home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3 / CHAPTE21 / EX17.C < prev    next >
C/C++ Source or Header  |  1995-05-28  |  2KB  |  55 lines

  1. #include <genstub.c>
  2.  
  3. LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  4. {
  5.    switch (uMsg)
  6.    {
  7.          case WM_COMMAND:
  8.                switch ( LOWORD( wParam ) )
  9.                {
  10.                      case IDM_TEST:
  11.                      {
  12.                         char szBuffer[128];
  13.                         SYSTEMTIME stUniversalTime;
  14.                         SYSTEMTIME stLocalTime;
  15.                         TIME_ZONE_INFORMATION tz;
  16.  
  17.                         GetTimeZoneInformation( &tz );
  18.                         wsprintf( szBuffer,
  19.                                   "Bias: %ld, Name: %s, Day: %d, Month: %d, Year: %d",
  20.                                   tz.Bias + tz.StandardBias, tz.StandardName,
  21.                                   tz.StandardDate.wDay,
  22.                                   tz.StandardDate.wMonth,
  23.                                   tz.StandardDate.wYear );
  24.                         MessageBox( hWnd, szBuffer, "Standard Date", MB_OK );
  25.                         wsprintf( szBuffer,
  26.                                   "Bias: %ld, Name: %s, Day: %d, Month: %d, Year: %d",
  27.                                   tz.Bias + tz.DaylightBias, tz.DaylightName,
  28.                                   tz.DaylightDate.wDay,
  29.                                   tz.DaylightDate.wMonth,
  30.                                   tz.DaylightDate.wYear );
  31.                         MessageBox( hWnd, szBuffer, "Daylight Date", MB_OK );
  32.                         GetSystemTime( &stUniversalTime );
  33.                         SystemTimeToTzSpecificLocalTime( &tz, &stUniversalTime,
  34.                                                          &stLocalTime );
  35.                         wsprintf( szBuffer, "Hour: %d, Minute: %d, Second: %d",
  36.                                   stLocalTime.wHour, stLocalTime.wMinute,
  37.                                   stLocalTIme.wSecond );
  38.                         MessageBox( hWnd, szBuffer, "Converted Time", MB_OK );
  39.                         break;
  40.                      }
  41.                      case IDM_EXIT:
  42.                         DestroyWindow( hWnd );
  43.                         break;
  44.                 }
  45.                 break;
  46.             }
  47.             break;
  48.          case WM_DESTROY:
  49.                PostQuitMessage( 0 );
  50.                break;
  51.          default:
  52.             return (DefWindowProc(hWnd, uMsg, wParam, lParam));
  53.    }
  54.    return (NULL);
  55. }